#pragma once
// MESSAGE Gyroscope PACKING

#define MAVLINK_MSG_ID_Gyroscope 150

MAVPACKED(
typedef struct __mavlink_gyroscope_t {
 uint32_t gytempreture; /*< [degree] gyroscope chip temperature.*/
 uint32_t gylingdata; /*< [null] gyroscope offset data.*/
 uint32_t qystartdata; /*< [null] gyroscope original data.*/
 uint32_t gylvdata; /*< [null] gyroscope filtered data.*/
 uint32_t gyangle; /*< [degree] gyroscope get angles data.*/
 uint32_t gyP; /*< [null] gyroscope Kalman filter P param.*/
 uint32_t gyQ; /*< [null] gyroscope Kalman filter Q param.*/
 uint32_t gyR; /*< [null] gyroscope Kalman filter R param.*/
}) mavlink_gyroscope_t;

#define MAVLINK_MSG_ID_Gyroscope_LEN 32
#define MAVLINK_MSG_ID_Gyroscope_MIN_LEN 32
#define MAVLINK_MSG_ID_150_LEN 32
#define MAVLINK_MSG_ID_150_MIN_LEN 32

#define MAVLINK_MSG_ID_Gyroscope_CRC 50
#define MAVLINK_MSG_ID_150_CRC 50



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_Gyroscope { \
    150, \
    "Gyroscope", \
    8, \
    {  { "gytempreture", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gyroscope_t, gytempreture) }, \
         { "gylingdata", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_gyroscope_t, gylingdata) }, \
         { "qystartdata", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_gyroscope_t, qystartdata) }, \
         { "gylvdata", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_gyroscope_t, gylvdata) }, \
         { "gyangle", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_gyroscope_t, gyangle) }, \
         { "gyP", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gyroscope_t, gyP) }, \
         { "gyQ", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_gyroscope_t, gyQ) }, \
         { "gyR", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_gyroscope_t, gyR) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_Gyroscope { \
    "Gyroscope", \
    8, \
    {  { "gytempreture", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gyroscope_t, gytempreture) }, \
         { "gylingdata", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_gyroscope_t, gylingdata) }, \
         { "qystartdata", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_gyroscope_t, qystartdata) }, \
         { "gylvdata", NULL, MAVLINK_TYPE_UINT32_T, 0, 12, offsetof(mavlink_gyroscope_t, gylvdata) }, \
         { "gyangle", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_gyroscope_t, gyangle) }, \
         { "gyP", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_gyroscope_t, gyP) }, \
         { "gyQ", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_gyroscope_t, gyQ) }, \
         { "gyR", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_gyroscope_t, gyR) }, \
         } \
}
#endif

/**
 * @brief Pack a gyroscope message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param gytempreture [degree] gyroscope chip temperature.
 * @param gylingdata [null] gyroscope offset data.
 * @param qystartdata [null] gyroscope original data.
 * @param gylvdata [null] gyroscope filtered data.
 * @param gyangle [degree] gyroscope get angles data.
 * @param gyP [null] gyroscope Kalman filter P param.
 * @param gyQ [null] gyroscope Kalman filter Q param.
 * @param gyR [null] gyroscope Kalman filter R param.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_gyroscope_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               uint32_t gytempreture, uint32_t gylingdata, uint32_t qystartdata, uint32_t gylvdata, uint32_t gyangle, uint32_t gyP, uint32_t gyQ, uint32_t gyR)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_Gyroscope_LEN];
    _mav_put_uint32_t(buf, 0, gytempreture);
    _mav_put_uint32_t(buf, 4, gylingdata);
    _mav_put_uint32_t(buf, 8, qystartdata);
    _mav_put_uint32_t(buf, 12, gylvdata);
    _mav_put_uint32_t(buf, 16, gyangle);
    _mav_put_uint32_t(buf, 20, gyP);
    _mav_put_uint32_t(buf, 24, gyQ);
    _mav_put_uint32_t(buf, 28, gyR);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_Gyroscope_LEN);
#else
    mavlink_gyroscope_t packet;
    packet.gytempreture = gytempreture;
    packet.gylingdata = gylingdata;
    packet.qystartdata = qystartdata;
    packet.gylvdata = gylvdata;
    packet.gyangle = gyangle;
    packet.gyP = gyP;
    packet.gyQ = gyQ;
    packet.gyR = gyR;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_Gyroscope_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_Gyroscope;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_Gyroscope_MIN_LEN, MAVLINK_MSG_ID_Gyroscope_LEN, MAVLINK_MSG_ID_Gyroscope_CRC);
}

/**
 * @brief Pack a gyroscope message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param gytempreture [degree] gyroscope chip temperature.
 * @param gylingdata [null] gyroscope offset data.
 * @param qystartdata [null] gyroscope original data.
 * @param gylvdata [null] gyroscope filtered data.
 * @param gyangle [degree] gyroscope get angles data.
 * @param gyP [null] gyroscope Kalman filter P param.
 * @param gyQ [null] gyroscope Kalman filter Q param.
 * @param gyR [null] gyroscope Kalman filter R param.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_gyroscope_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   uint32_t gytempreture,uint32_t gylingdata,uint32_t qystartdata,uint32_t gylvdata,uint32_t gyangle,uint32_t gyP,uint32_t gyQ,uint32_t gyR)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_Gyroscope_LEN];
    _mav_put_uint32_t(buf, 0, gytempreture);
    _mav_put_uint32_t(buf, 4, gylingdata);
    _mav_put_uint32_t(buf, 8, qystartdata);
    _mav_put_uint32_t(buf, 12, gylvdata);
    _mav_put_uint32_t(buf, 16, gyangle);
    _mav_put_uint32_t(buf, 20, gyP);
    _mav_put_uint32_t(buf, 24, gyQ);
    _mav_put_uint32_t(buf, 28, gyR);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_Gyroscope_LEN);
#else
    mavlink_gyroscope_t packet;
    packet.gytempreture = gytempreture;
    packet.gylingdata = gylingdata;
    packet.qystartdata = qystartdata;
    packet.gylvdata = gylvdata;
    packet.gyangle = gyangle;
    packet.gyP = gyP;
    packet.gyQ = gyQ;
    packet.gyR = gyR;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_Gyroscope_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_Gyroscope;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_Gyroscope_MIN_LEN, MAVLINK_MSG_ID_Gyroscope_LEN, MAVLINK_MSG_ID_Gyroscope_CRC);
}

/**
 * @brief Encode a gyroscope struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param gyroscope C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_gyroscope_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gyroscope_t* gyroscope)
{
    return mavlink_msg_gyroscope_pack(system_id, component_id, msg, gyroscope->gytempreture, gyroscope->gylingdata, gyroscope->qystartdata, gyroscope->gylvdata, gyroscope->gyangle, gyroscope->gyP, gyroscope->gyQ, gyroscope->gyR);
}

/**
 * @brief Encode a gyroscope struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param gyroscope C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_gyroscope_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gyroscope_t* gyroscope)
{
    return mavlink_msg_gyroscope_pack_chan(system_id, component_id, chan, msg, gyroscope->gytempreture, gyroscope->gylingdata, gyroscope->qystartdata, gyroscope->gylvdata, gyroscope->gyangle, gyroscope->gyP, gyroscope->gyQ, gyroscope->gyR);
}

/**
 * @brief Send a gyroscope message
 * @param chan MAVLink channel to send the message
 *
 * @param gytempreture [degree] gyroscope chip temperature.
 * @param gylingdata [null] gyroscope offset data.
 * @param qystartdata [null] gyroscope original data.
 * @param gylvdata [null] gyroscope filtered data.
 * @param gyangle [degree] gyroscope get angles data.
 * @param gyP [null] gyroscope Kalman filter P param.
 * @param gyQ [null] gyroscope Kalman filter Q param.
 * @param gyR [null] gyroscope Kalman filter R param.
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_gyroscope_send(mavlink_channel_t chan, uint32_t gytempreture, uint32_t gylingdata, uint32_t qystartdata, uint32_t gylvdata, uint32_t gyangle, uint32_t gyP, uint32_t gyQ, uint32_t gyR)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_Gyroscope_LEN];
    _mav_put_uint32_t(buf, 0, gytempreture);
    _mav_put_uint32_t(buf, 4, gylingdata);
    _mav_put_uint32_t(buf, 8, qystartdata);
    _mav_put_uint32_t(buf, 12, gylvdata);
    _mav_put_uint32_t(buf, 16, gyangle);
    _mav_put_uint32_t(buf, 20, gyP);
    _mav_put_uint32_t(buf, 24, gyQ);
    _mav_put_uint32_t(buf, 28, gyR);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_Gyroscope, buf, MAVLINK_MSG_ID_Gyroscope_MIN_LEN, MAVLINK_MSG_ID_Gyroscope_LEN, MAVLINK_MSG_ID_Gyroscope_CRC);
#else
    mavlink_gyroscope_t packet;
    packet.gytempreture = gytempreture;
    packet.gylingdata = gylingdata;
    packet.qystartdata = qystartdata;
    packet.gylvdata = gylvdata;
    packet.gyangle = gyangle;
    packet.gyP = gyP;
    packet.gyQ = gyQ;
    packet.gyR = gyR;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_Gyroscope, (const char *)&packet, MAVLINK_MSG_ID_Gyroscope_MIN_LEN, MAVLINK_MSG_ID_Gyroscope_LEN, MAVLINK_MSG_ID_Gyroscope_CRC);
#endif
}

/**
 * @brief Send a gyroscope message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_gyroscope_send_struct(mavlink_channel_t chan, const mavlink_gyroscope_t* gyroscope)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_gyroscope_send(chan, gyroscope->gytempreture, gyroscope->gylingdata, gyroscope->qystartdata, gyroscope->gylvdata, gyroscope->gyangle, gyroscope->gyP, gyroscope->gyQ, gyroscope->gyR);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_Gyroscope, (const char *)gyroscope, MAVLINK_MSG_ID_Gyroscope_MIN_LEN, MAVLINK_MSG_ID_Gyroscope_LEN, MAVLINK_MSG_ID_Gyroscope_CRC);
#endif
}

#if MAVLINK_MSG_ID_Gyroscope_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_gyroscope_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint32_t gytempreture, uint32_t gylingdata, uint32_t qystartdata, uint32_t gylvdata, uint32_t gyangle, uint32_t gyP, uint32_t gyQ, uint32_t gyR)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_uint32_t(buf, 0, gytempreture);
    _mav_put_uint32_t(buf, 4, gylingdata);
    _mav_put_uint32_t(buf, 8, qystartdata);
    _mav_put_uint32_t(buf, 12, gylvdata);
    _mav_put_uint32_t(buf, 16, gyangle);
    _mav_put_uint32_t(buf, 20, gyP);
    _mav_put_uint32_t(buf, 24, gyQ);
    _mav_put_uint32_t(buf, 28, gyR);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_Gyroscope, buf, MAVLINK_MSG_ID_Gyroscope_MIN_LEN, MAVLINK_MSG_ID_Gyroscope_LEN, MAVLINK_MSG_ID_Gyroscope_CRC);
#else
    mavlink_gyroscope_t *packet = (mavlink_gyroscope_t *)msgbuf;
    packet->gytempreture = gytempreture;
    packet->gylingdata = gylingdata;
    packet->qystartdata = qystartdata;
    packet->gylvdata = gylvdata;
    packet->gyangle = gyangle;
    packet->gyP = gyP;
    packet->gyQ = gyQ;
    packet->gyR = gyR;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_Gyroscope, (const char *)packet, MAVLINK_MSG_ID_Gyroscope_MIN_LEN, MAVLINK_MSG_ID_Gyroscope_LEN, MAVLINK_MSG_ID_Gyroscope_CRC);
#endif
}
#endif

#endif

// MESSAGE Gyroscope UNPACKING


/**
 * @brief Get field gytempreture from gyroscope message
 *
 * @return [degree] gyroscope chip temperature.
 */
static inline uint32_t mavlink_msg_gyroscope_get_gytempreture(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  0);
}

/**
 * @brief Get field gylingdata from gyroscope message
 *
 * @return [null] gyroscope offset data.
 */
static inline uint32_t mavlink_msg_gyroscope_get_gylingdata(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  4);
}

/**
 * @brief Get field qystartdata from gyroscope message
 *
 * @return [null] gyroscope original data.
 */
static inline uint32_t mavlink_msg_gyroscope_get_qystartdata(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  8);
}

/**
 * @brief Get field gylvdata from gyroscope message
 *
 * @return [null] gyroscope filtered data.
 */
static inline uint32_t mavlink_msg_gyroscope_get_gylvdata(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  12);
}

/**
 * @brief Get field gyangle from gyroscope message
 *
 * @return [degree] gyroscope get angles data.
 */
static inline uint32_t mavlink_msg_gyroscope_get_gyangle(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  16);
}

/**
 * @brief Get field gyP from gyroscope message
 *
 * @return [null] gyroscope Kalman filter P param.
 */
static inline uint32_t mavlink_msg_gyroscope_get_gyP(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  20);
}

/**
 * @brief Get field gyQ from gyroscope message
 *
 * @return [null] gyroscope Kalman filter Q param.
 */
static inline uint32_t mavlink_msg_gyroscope_get_gyQ(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  24);
}

/**
 * @brief Get field gyR from gyroscope message
 *
 * @return [null] gyroscope Kalman filter R param.
 */
static inline uint32_t mavlink_msg_gyroscope_get_gyR(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint32_t(msg,  28);
}

/**
 * @brief Decode a gyroscope message into a struct
 *
 * @param msg The message to decode
 * @param gyroscope C-struct to decode the message contents into
 */
static inline void mavlink_msg_gyroscope_decode(const mavlink_message_t* msg, mavlink_gyroscope_t* gyroscope)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    gyroscope->gytempreture = mavlink_msg_gyroscope_get_gytempreture(msg);
    gyroscope->gylingdata = mavlink_msg_gyroscope_get_gylingdata(msg);
    gyroscope->qystartdata = mavlink_msg_gyroscope_get_qystartdata(msg);
    gyroscope->gylvdata = mavlink_msg_gyroscope_get_gylvdata(msg);
    gyroscope->gyangle = mavlink_msg_gyroscope_get_gyangle(msg);
    gyroscope->gyP = mavlink_msg_gyroscope_get_gyP(msg);
    gyroscope->gyQ = mavlink_msg_gyroscope_get_gyQ(msg);
    gyroscope->gyR = mavlink_msg_gyroscope_get_gyR(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_Gyroscope_LEN? msg->len : MAVLINK_MSG_ID_Gyroscope_LEN;
        memset(gyroscope, 0, MAVLINK_MSG_ID_Gyroscope_LEN);
    memcpy(gyroscope, _MAV_PAYLOAD(msg), len);
#endif
}
